﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StudyCode.Factory
{
    class Program
    {
        static void Main(string[] args)
        {
            var reportCard=ReportFactory.Instance.CreateReportCard();
            //do something ..
            reportCard = null;

            //readonly 不能赋值
            //ReportFactory.Instance = null;
        }
    }


    public class ReportFactory
    {

        public readonly static ReportFactory Instance =new ReportFactory();
        
        private ReportFactory()
        {
        }

        //private static  ReportFactory _instance = null;
        //public static  ReportFactory Instance
        //{
        //    get
        //    {
        //        if (_instance == null)
        //            _instance = new ReportFactory();
        //        return _instance;
        //    }
        //}

        public ReportCard CreateReportCard()
        {
            return new ReportCard();
        }

    }



    public class ReportCard
    {
        public string Name { get; set; }

        public string Class { get; set; }

        public int Score { get; set; }
    }
}
